
from PIL import Image
import os


def addshuiyin(imagename, shuiyinname):

    # 需要加水印的图片
    img = Image.open(imagename)
    # 水印图片
    logo = Image.open(shuiyinname)

    #   图层
    layer = Image. new('RGBA', img. size, (255, 255, 255, 0))
    layer. paste(
        logo, (img. size[0]-logo. size[0], img. size[1]-logo. size[1]))

    # 覆盖
    img_after = Image. composite(layer, img, layer)

    img_after.show()

    # img_after.save(' target. jpe)
# addshuiyin(r'd:\1\1 (1).png', r'd:\shuiyin.png')


img_suffix_list = ['png', 'jpg', 'bmp']
for i in os.listdir(r"d:\1"):
    if i.split('.')[-1] in img_suffix_list:
        print(i)
